package com.huawei.appgallery.forum.forum.card;

import android.content.Context;
import android.view.View;
import android.view.ViewTreeObserver.OnPreDrawListener;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.forum.forum.widget.BounceHorizontalRecyclerView;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import java.util.List;
import o.azb;
import o.bun.c;
import o.but;
import o.buv;
import o.cgz;
import o.chy;
import o.dof;
import o.evx;

public class ForumListCard extends ForumCard {
    private String ʽ;
    private String ˊ;
    protected chy ˋ;
    protected BounceHorizontalRecyclerView ˎ;
    private View ˏ;
    protected but ॱ;

    public ForumListCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ʽ(view);
        azb.ˏ(view, c.ᐝˊ);
        this.ʿ = (TextView) view.findViewById(c.ˎˎ);
        this.ˏ = view.findViewById(c.ˌ);
        ˎ(view);
        return this;
    }

    private void ˎ(View view) {
        this.ˎ = (BounceHorizontalRecyclerView) view.findViewById(c.ˊ);
        this.ˎ.setHasFixedSize(true);
        this.ˎ.setNestedScrollingEnabled(false);
        this.ˎ.setLayoutManager(new LinearLayoutManager(view.getContext(), 1, false));
        this.ॱ = new but(this.ʼॱ);
        this.ˎ.setAdapter(this.ॱ);
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof buv) {
            buv o_buv = (buv) cardBean;
            if (dof.ʽ(o_buv.v_())) {
                this.ʿ.setVisibility(4);
            } else {
                this.ʿ.setVisibility(0);
                this.ʿ.setText(o_buv.v_());
                this.ʿ.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener(this) {
                    final /* synthetic */ ForumListCard ˋ;

                    {
                        this.ˋ = r1;
                    }

                    public boolean onPreDraw() {
                        this.ˋ.ʿ.getViewTreeObserver().removeOnPreDrawListener(this);
                        if (this.ˋ.ʿ.getLineCount() > 1) {
                            this.ˋ.ʿ.setMaxLines(2);
                        } else {
                            this.ˋ.ʿ.setMaxLines(1);
                        }
                        return true;
                    }
                });
            }
            if (dof.ʽ(o_buv.ॱॱ())) {
                ˎ().setVisibility(8);
            } else {
                ˎ().setVisibility(0);
            }
            List ˊ = o_buv.ˊ();
            if (ˊ != null && ˊ.size() > 0) {
                this.ॱ.ˋ(ˊ);
            }
            this.ˊ = o_buv.ॱॱ();
            this.ʽ = o_buv.v_();
        }
    }

    public void ˎ(BaseCardBean baseCardBean) {
        super.ˎ(baseCardBean);
    }

    public View ˎ() {
        return this.ˏ;
    }

    public void ॱ(final chy o_chy) {
        this.ˋ = o_chy;
        ˎ().setOnClickListener(new evx(this) {
            final /* synthetic */ ForumListCard ॱ;

            public void ˋ(View view) {
                o_chy.ˏ(9, this.ॱ);
            }
        });
    }
}
